import React, { memo, useEffect, useState } from "react"
import { useLocalStorage } from "./hooks"

const App = memo(() => {
    // const [token, setToken] = useState(localStorage.getItem("token"))
    // useEffect(() => {
    //     localStorage.setItem("token", token)
    // }, [token])
    const [token, setToken] = useLocalStorage("token")
    function handleToken() {
        setToken("123")
    }

    return (
        <div className="app">
            <h1>App Component：{token}</h1>
            <button onClick={handleToken}>设置token</button>
        </div>
    )
})

export default App
